<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>督查系统</title>
    <%--<link rel="stylesheet" href="/index/css/bootstrap.min.css">--%>
    <%--<link rel="stylesheet" href="/index/css/common.css">--%>
    <%--<link rel="stylesheet" href="/index/css/ducha.css">--%>
    <%@ include file="/WEB-INF/views/include/header.jsp" %>
</head>
<style>
    li{
        list-style-type: none;
    }
    body {
        background: #fff !important;
    }

    .indexProject {
        width: 200px;
        background: url("/index/images/ducha/Project approval.png") no-repeat;
        background-size: 90%;
        background-position: center;
        height: 208px;
    }

    .indexProject1 {
        background: url("/index/images/ducha/Notdone.png") no-repeat;
        background-size: 90%;
        background-position: center;
    }

    .indexProject2 {
        background: url("/index/images/ducha/Already done.png") no-repeat;
        background-size: 90%;
        background-position: center;
    }
    .indexProject3 {
        background: url("/index/images/ducha/reportForm.png") no-repeat;
        background-size: 90%;
        background-position: center;
    }
    section > div {
        cursor: pointer;
    }
    table, th, td
    {
        border: 1px solid #ddd;
    }
    .heaBg{
        height: 500px;
        background: url("/index/images/ducha/Carousel.png") no-repeat;
        background-size: 100% 100%;
        position: relative;
        margin-bottom: 10px;
    }
    .phone{
        width: 18%;
        height: 83%;
        /*background: url(/index/images/ducha/phone.png) no-repeat;*/
        background-size: 100% 100%;
        position: absolute;
        z-index: 1;
        left: 64.7%;
        bottom: 0;
    }
    .phone>div.notice_active{
        padding: 90px 0 0;
        height: 100%;
        border-bottom: none;
        overflow: hidden;
    }
    li{
        background: #fff;
        margin-top: 10px;
        cursor: pointer;
    }

    .notice_active>.carousel{
        height: 113%;
        overflow: hidden;
    }
    .notice_active li{
        height: 126px;
        background: url(/index/images/ducha/ggbj.png);
        background-size: 100% 100%;
        border: 2px solid #fff;
        border-radius: 10px;
    }
    .notice_active p{
        color: #fff;
        padding-left: 10px;
        width: 66%;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        overflow: hidden;
    }
    .notice_active h4{
        font-weight: bold;
        color: #fff;
        padding-left: 10px;
        width: 66%;
        overflow: hidden;/*超出部分隐藏*/
        white-space: nowrap;/*不换行*/
        text-overflow:ellipsis;/*超出部分文字以...显示*/
    }
    ul{
        height: 100%;
        overflow: hidden;
        margin: 0px;
        padding: 0 15px;
    }
    .modal-dialog{
        width: 80% !important;
    }
    .img-thumbnail{
        border: none;
    }
    .notice_active_ch p {
        position: relative;
        font-size: 13px;
        line-height: 17px;
        text-align: left;
        overflow: hidden;
    }
    .p-after:after{
        content: "...";
        position: absolute;
        bottom: 0;
        right: 0;
        padding-left: 40px;
    }
    /* turnOver 上下页,周文档*/
    .turnOver{
        display: flex;
        justify-content: space-evenly;
        margin: 10px 0;
    }
    .btn_up,.btn_down,.preview{
        border-radius: 5px;
        background-color: #00B8FF;
        border: none;
        color: #fff;
        height: 25px;
        line-height: 25px;
        padding: 0 10px;
    }

    .btn-left{
        position: absolute;
        left: 16px;
    }

    .btn-right{
        position: absolute;
        right: 16px;
    }
    .turnOver{
        height: 18px;
    }
    /*weekly 周文档*/
    .weekly{
        position: absolute;
        left: 71.6%;
        top: 37%;
        z-index: 10;
    }
    .weekly .viewDocument{
        border-radius: 5px;
        background-color: #d15b47;
        border: none;
        outline: none;
        color: #fff;
        height: 25px;
        line-height: 25px;
        padding: 0 10px;
    }
</style>
<body>
<%--模态框--%>
<div class="modal fade" id="UrgeModel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"
     data-backdrop="static">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-body">
                <h1 class="text-center">经济指标</h1>
                <div>
                    <img src="/index/images/ducha/0.png" class="img-thumbnail">
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
<header>
    <%--<button class="btn" id="jumps">跳转页面</button>--%>
    <div class="heaBg">
        <%--<div class="shine">本周关注<span style="font-size: 30px">➨</span></div>--%>
        <a href="" id="wendang" target="_blank"></a>
        <div class="weekly">
            <button class="btn btn-danger viewDocument">查看全部</button>
        </div>
        <div class="phone">

            <div class="notice_active">
                <div class="turnOver">
                    <div>
                        <button class="btn_up text-center btn-left"><span class="glyphicon glyphicon-arrow-up"></span>上一页</button>
                    </div>
                    <div>
                        <button class="hidden">全部简报 </button>
                    </div>
                    <div>
                        <button class="btn_down text-center btn-right"><span class="glyphicon glyphicon-arrow-down"></span>下一页</button>
                    </div>
                </div>
                <div class="carousel">
                    <ul>
                        <%--<li class="notice_active_ch" index="0" Tit="一、经济指标" style="">--%>
                            <%--<p></p>--%>
                            <%--&lt;%&ndash;<img src="/index/images/ducha/jj.png" alt="" class="img-thumbnail">&ndash;%&gt;--%>
                        <%--</li>--%>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</header>
<section style="display: flex;justify-content: space-around">
    <c:if test="${dept.deptRelation=='/01/'}">
        <div onclick='NewBox("/taskMain/createTask/","lixiang","立项")' class="indexProject">
            <div class="indexProject"></div>
            <p class="text-center">立项</p>
        </div>
    </c:if>
    <c:if test="${dept.deptRelation=='/02/201/' or dept.deptRelation=='/02/202/'}">
        <div onclick='NewBox("/taskUnit/hastenMessage/","cuiban","催办信息")'>
                <%--<div class="indexProject"></div>--%>
            <div class="text-center indexProject indexProject1">
                <span style="font-size: 100px;font-weight: bold;line-height: 200px;vertical-align: middle;color: red">${cb}</span>
            </div>
            <p class="text-center">催办信息</p>
        </div>
    </c:if>
    <c:if test="${dept.deptRelation=='/01/'}">
        <div onclick='NewBox("/taskMain/noDoneMain/","daiban1","待办事项")'>
            <div class="text-center indexProject indexProject1">
                <span style="font-size: 100px;font-weight: bold;line-height: 200px;vertical-align: middle;color: red">${dwc}</span>
            </div>
            <p class="text-center">待办事项</p>
        </div>
    </c:if>
    <c:if test="${dept.deptRelation=='/02/201/' or dept.deptRelation=='/02/202/'}">

        <div onclick='NewBox("/taskUnit/noDoneUnit/","daiban2","待办事项")'>
            <div class="text-center indexProject indexProject1">
                <span style="font-size: 100px;font-weight: bold;line-height: 200px;vertical-align: middle;color: red">${dwc}</span>
            </div>
            <p class="text-center">待办事项</p>
        </div>
    </c:if>
    <c:if test="${dept.deptRelation=='/01/'}">
        <div onclick='NewBox("/taskMain/doneMain/","yiban","已办事项")'>
            <div class="text-center indexProject indexProject2">
                <span style="font-size: 100px;font-weight: bold;line-height: 200px;vertical-align: middle;color: red">${ywc}</span>
            </div>
            <p class="text-center">已办事项</p>
        </div>
    </c:if>
    <c:if test="${dept.deptRelation=='/02/201/' or dept.deptRelation=='/02/202/'}">
        <div onclick='NewBox("/taskUnit/doneUnit/","yiban2","已办事项")'>
            <div class="text-center indexProject indexProject2">
                <span style="font-size: 100px;font-weight: bold;line-height: 200px;vertical-align: middle;color: red">${ywc}</span>
            </div>
            <p class="text-center">已办事项</p>
        </div>
    </c:if>
    <div onclick='NewBox("/table/showDuCha/","table_xian","绩效评分")'>
        <div class="text-center indexProject indexProject3"></div>
        <p class="text-center">绩效评分</p>
    </div>
    <c:if test="${dept.sysId == '20190722100000000194'}">
        <div onclick='NewBox("/common/releaseBriefing/","jianbao","攻坚简报")'>
            <div class="text-center indexProject indexProject"></div>
            <p class="text-center">简报</p>
        </div>
    </c:if>
</section>
<%--周文档id--%>
<input type="text" id="pdfid" hidden>
<script src="/index/js/jquery.min.js"></script>
<script src="/index/js/bootstrap.min.js"></script>
<%--<script src="/index/js/echarts.min.js"></script>--%>
<script src="/index/js/ducha.js"></script>
<%@ include file="/WEB-INF/views/include/footer.jsp" %>
<script>
    $(function(){
        //临时
        $("#jumps").click(function () {
            parent.openapp("/taskUnit/createTask/","1111","立项");
        });
    })
</script>
<script>
    $(function () {
        //周文档预览
        $(".weekly").click(function () {
            var pdfid =$("#pdfid").val();
            if(pdfid !== ""){
                window.open("/filesUpload/devDoc?id="+pdfid);
                // window.open("/filesUpload/devDoc?id="+pdfid, "_blank","top=200,left=200,height=600,width=800,status=yes,toolbar=1,menubar=no,location=no,scrollbars=yes");
            }else{
                alert("暂无周文档！！！");
            }
        });
    })

    function finPdf(id){
        window.open("/fileUpload/devDoc?id=20191126100000000638");
    }

    function NewBox(url, name, title) {
        parent.openapp(url, name, title)
    }
    //    滚动轮播
    function timer(opj){
        // 轮播切换有问题  两个的时候一跳一跳的
        $(opj).find('ul').animate({
            marginTop : "-126px"
        },500,function(){
            $(this).css({marginTop : "0px"}).find("li:first").appendTo(this);
        })
    }
    $(function(){
        $.get("/common/releaseBriefing/getBriefing",function (res) {
            // 为了管理简报 增加及时上下架  现在先不管全查询
            if (res && res.data != undefined) {
                var list = res.data
                var html = '';
                var num = list.length;
                for (var i=0;i<list.length;i++){
                    if (list[i].sysId == undefined){
                        continue;
                    }
                    html +="  <li class=\"notice_active_ch\" index=\"" +i+ "\" data-id=\"" + list[i].sysId + "\" Tit=\""+ list[i].title +"\">\n" +
                        "<h4 title=\""+ list[i].title +"\">"+(i+1)+"、"+ list[i].title +"</h4>\n" +
                        "<p>"+list[i].summary+"</p>\n" +
                        "</li>"
                }
                $(".notice_active ul").html(html);
                if(num > 2){
                    var time=setInterval('timer(".notice_active")',3000);
                    $('.notice_active').mousemove(function(){
                        clearInterval(time);
                    }).mouseout(function(){
                        time = setInterval('timer(".notice_active")',3000);
                    });
                }
            };
            //获取文本的行高，并获取文本的高度，假设我们规定的行数是五行，那么对超过行数的部分进行限制高度，并加上省略号
            $('.notice_active_ch p').each(function(i, obj){
                var lineHeight = parseInt($(this).css("line-height"));//行高
                var height = parseInt($(this).height());
                console.log(height);
                if((height / lineHeight) >3 ){
                    $(this).addClass("p-after")
                    $(this).css("height","85px");
                }else{
                    $(this).removeClass("p-after");
                }
            });
        });

    //    btn_down btn_up
        $(".btn_down").click(function () {
            $('.carousel ul').append($('.carousel li:eq(0)'));
        });
        $(".btn_up").click(function () {
            var $index = $('.carousel li').length-1
            $('.carousel ul').prepend($('.carousel li:eq('+$index+')'));
        })
    });

    //    点击li 去模态框 .attr("Tit")
    $(".notice_active ul").on("click","li", function() {
        var sysid = $(this).data('id')
        if(sysid != undefined) {
            $.get('/common/releaseBriefing/getBriefing/'+sysid,function (res) {
                console.log(res.data.annex);
                //检测判断空值
                if(res){
                    var body = '<h1 class="text-center">'+res.data.title+'</h1><div>'
                        + escape2Html(res.data.content)
                        +'</div>'
                    var btn2 = " <button type=\"button\" class=\"btn btn-success file\" annex=\""+ res.data.annex + "\" >下载附件</button>" +
                        "                <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">关闭</button>\n";
                    var btn1 = "         <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">关闭</button>\n";

                    if (!res.data.annex){
                        $('#UrgeModel').find(".modal-footer").html(btn1);
                    }else{
                        $('#UrgeModel').find(".modal-footer").html(btn2);
                    }
                    $('#UrgeModel').find(".modal-body").html(body);
                }
            })
        } else {
            //保留预创建
            var $index = $(this).attr("index");
            var $title = $(this).children("h4").attr("Tit")
            $('#UrgeModel').find(".modal-body h1").html($title);
            $('#UrgeModel').find(".modal-body img").attr("src","/index/images/ducha/"+  $index +".png");
        }

        $('#UrgeModel').modal('show'); //显示
    })

    function escape2Html(str) {
        if(str ==undefined || str==''){
            return ''
        }
        var arrEntities = {'lt': '<', 'gt': '>', 'nbsp': ' ', 'amp': '&', 'quot': '"'};
        return str.replace(/&(lt|gt|nbsp|amp|quot);/ig, function (all, t) {
            return arrEntities[t];
        });
    }
    $(document).on("click",".file",function () {
        var $annex = $(this).attr("annex");
        console.log($annex)
        var url = "/filesUpload/download?id=" + $annex;
        window.open(url);
    });


    // $(".weekly").click(function () {
    //     $('#UrgeModel').modal('show'); //显示
    // });


    $(function () {
        //请求周文档显示
        $.get('/common/releaseBriefing/getWeekDoc',function (res) {
            console.log(res);
            if(res){
                if(res.code != undefined && res.code == '200') {
                   if(res.data !== undefined){
                        $("#pdfid").val(res.data);
                   }

                } else {
                    console.log('查看失败')
                }
            } else {
                alert('系统错误，请稍后重试！')
            }
        })
    })

</script>
</body>

</html>